package com.thirteen.app.controller;

import com.thirteen.app.service.QuestionService;
import com.thirteen.app.utils.tools.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.oas.annotations.EnableOpenApi;

import javax.annotation.Resource;

@CrossOrigin
@Api(tags = "错题管理模块")
@EnableOpenApi
@RestController
@RequestMapping("/api/student/wrongQu")
public class WrongQuestionController {
    @Resource
    private QuestionService questionService;

    @PostMapping("selectAll")
    @ApiOperation("获取错题列表")
    public CommonResult selectAll(String content, Integer examId, Integer userId) {
        return CommonResult.success(questionService.selectAllWrongQuestions(content, examId, userId));
    }

    @PostMapping("deleteWrongQu")
    @ApiOperation("删除错题")
    public CommonResult deleteWrongQu(Integer questionId, Integer examId) {
        System.out.println(questionId);
        return CommonResult.success(questionService.deleteWrongQu(questionId, examId));
    }
}
